# 1. 将所有数据存储在一个多行字符串中
data_string = """
-3.458984, -11.929688, 1.041992, -15.117188, -10.835938, 7.687500, -6.316406, -3.980469, -24.312500, -10.148438, 1.910156, -1.176758, -6.035156, 1.808594, -5.179688, -2.984375, 0.981445, -12.242188, 0.372070, -1.070312, -2.347656, 1.247070, 2.197266, -3.791016, -8.687500, -5.199219, 10.515625, 7.445312, 4.066406, 7.562500, -6.253906, 
-7.468750, 6.609375, 6.324219, 11.000000, -16.375000, -3.777344, -5.113281, -5.695312, 0.420166, -8.031250, -1.563477, 4.984375, -2.738281, 3.564453, 10.703125, -3.853516, -3.048828, -5.468750, -0.439697, -1.184570, -9.289062, 9.398438, 8.976562, -0.018326, -9.742188, -8.796875, -1.218750, -0.091187, 0.820312, -3.589844, 
-11.015625, -6.195312, 2.628906, -11.429688, -9.867188, -5.914062, 10.148438, 0.906250, -9.921875, -5.179688, -2.238281, 8.351562, -6.175781, -9.437500, 2.505859, 15.343750, -10.234375, -7.203125, 2.937500, 5.304688, 0.407227, 8.296875, 4.300781, -5.878906, 13.617188, 3.833984, 4.238281, 1.014648, -0.495850, -5.062500, 
3.107422, -5.234375, -5.988281, 4.367188, 6.515625, 8.359375, -6.640625, -4.320312, -8.093750, -8.304688, -14.273438, -5.535156, 5.730469, -3.115234, 12.750000, -3.490234, 5.699219, 2.509766, 12.234375, -8.171875, -13.523438, 7.058594, -4.902344, -5.777344, -4.582031, 8.328125, -0.097839, 6.484375, 2.515625, -2.847656, 
8.000000, -15.906250, -5.875000, -1.653320, 9.148438, 0.653320, -18.781250
"""

# 2. 清理字符串并将其转换为一个数字列表
# - .replace('\n', ' ') 将所有换行符替换为空格，使数据变为单行
# - .split(',') 按逗号分割成一个字符串列表
# - s.strip() 去除每个数字字符串前后的多余空格
# - float() 将字符串转换为浮点数
# - if s.strip() 确保不会转换由尾部逗号等产生的空字符串
numbers = [float(s.strip()) for s in data_string.replace('\n', ' ').split(',') if s.strip()]

# 3. 计算总和并打印结果
total_sum = sum(numbers)
number_count = len(numbers)

# 打印验证信息和最终结果
print(f"成功解析出 {number_count} 个数字。")
print(f"这些数字的总和是: {total_sum}")

# 你也可以格式化输出，比如保留几位小数
print(f"格式化后的总和 (保留4位小数): {total_sum:.4f}")